layui.use(['form', 'element', 'layer', 'jquery'], function () {
    var form = layui.form
        , element = layui.element
        , layer = layui.layer
        , $ = layui.jquery;
    ;

    form.on('submit(login)', function (data) {
        $.post(homePath + '/user/login.do', data.field, function (data) {
            if (data.code == 0) {
                layer.msg(data.msg, {icon: 1, anim: 1, time: 1500}, function () {
                    window.location.href = homePath + "/";
                });
            } else {
                layer.msg(data.msg, {icon: 2});
            }
        }, 'json');
        return false;
    });

});